Commit 47f21cec by wnb0128

车家智能V1.0.0开发 用户数据--think.wang

1 parent 48b6e762
......@@ -34,7 +34,7 @@ public class SysFileController {
@RequestMapping(value = "/findAll", method = {RequestMethod.GET})
@ApiOperation(value = "查询图片")
public R findAll(@RequestParam("type") String type) {
public R findAll(@RequestParam("type") Byte type) {
List<FileDTO> fileDTOS = sysFileService.findByType(type);
return R.ok(JSONObject.toJSONString(fileDTOS));
}
......
package com.glsx.smart.controller;
import com.alibaba.fastjson.JSON;
import com.glsx.smart.dao.entity.SmartUserRelation;
import com.glsx.smart.service.SmartUserRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @Title: UserRelationController.java
* @Description:用户关系控制类
* @author think.wang
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Slf4j
@RestController
@RequestMapping("/user")
public class UserRelationController {
@Autowired
private SmartUserRelationService userRelationService;
@ResponseBody
@RequestMapping(value = "/getSingle", method = {RequestMethod.POST})
public SmartUserRelation getSingle(SmartUserRelation userRelation){
return userRelationService.getSingle(userRelation);
}
@ResponseBody
@RequestMapping(value = "/add", method = {RequestMethod.POST})
public boolean add(SmartUserRelation userRelation){
log.info("/user/add保存数据参数:{}", JSON.toJSONString(userRelation));
return userRelationService.insertSelective(userRelation) > 0 ? true : false;
}
}
package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartUserRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -25,4 +26,7 @@ public interface SmartUserRelationMapper
int updateBatchSelective(List<SmartUserRelation> list);
int batchInsert(@Param("list") List<SmartUserRelation> list);
SmartUserRelation getSingle(SmartUserRelation record);
}
package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSysFile;
import com.glsx.smart.pojo.FileDTO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* <p>Description:
......@@ -18,7 +17,7 @@ public interface SmartSysFileService {
int insertOrUpdate(SmartSysFile record);
List<FileDTO> findByType(String type);
List<FileDTO> findByType(Byte type);
void saveFile(List<FileDTO> files);
......
package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartUserRelation;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -18,7 +19,7 @@ public interface SmartUserRelationService {
int insertSelective(SmartUserRelation record);
List<SmartUserRelation> selectByExample(SmartUserRelation example);
SmartUserRelation getSingle(SmartUserRelation record);
SmartUserRelation selectByPrimaryKey(Long id);
......
......@@ -50,7 +50,7 @@ public class SmartSysFileServiceImpl implements SmartSysFileService {
* @return
*/
@Override
public List<FileDTO> findByType(String type) {
public List<FileDTO> findByType(Byte type) {
List<SmartSysFile> list=smartSysFileMapper.findByType(type);
List<FileDTO> fileDTOS = list.stream().map(index -> {
FileDTO fileDTO = new FileDTO();
......
package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartUserRelation;
import com.glsx.smart.dao.mapper.SmartUserRelationMapper;
import com.glsx.smart.exception.BusinessException;
......@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartUserRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -49,8 +50,8 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
}
@Override
public List<SmartUserRelation> selectByExample(SmartUserRelation example) {
return smartUserRelationMapper.select(example);
public SmartUserRelation getSingle(SmartUserRelation record) {
return smartUserRelationMapper.getSingle(record);
}
@Override
......
......@@ -442,6 +442,9 @@
<if test="typeKey != null and typeKey != ''">
and t.type_key = #{typeKey,jdbcType=VARCHAR}
</if>
<if test="userId != null and userId != ''">
and t.user_id = #{userId,jdbcType=BIGINT}
</if>
</where>
order by t.create_time desc
</select>
......
......@@ -290,4 +290,17 @@
</if>
</trim>
</insert>
<select id="getSingle" parameterType="com.glsx.smart.dao.entity.SmartUserRelation" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from smart_user_relation
where 1 = 1
<if test="phone != null and phone != ''">
and phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="channel != null">
and channel = #{channel,jdbcType=TINYINT}
</if>
limit 1
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!