Commit 6b9e348e authored by lining's avatar lining

feat: 估价员接口

parent bda7aca8
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
<select id="selectByNameLike" resultType="com.onsiteservice.entity.user.User"> <select id="selectByNameLike" resultType="com.onsiteservice.entity.user.User">
select * from user select * from user
where user_name like '%${name}%' where role_type = ${@com.onsiteservice.constant.enums.ServiceUserTypeEnum@VALUATOR.getId()}
and role_type = ${@com.onsiteservice.constant.enums.ServiceUserTypeEnum@VALUATOR.getId()} <if test="name !='' and test !=null ">
and user_name like '%${name}%'
</if>
order by create_time asc order by create_time asc
</select> </select>
......
...@@ -40,8 +40,8 @@ public class ServiceValuatorController { ...@@ -40,8 +40,8 @@ public class ServiceValuatorController {
} }
@ApiOperation(value = "根据姓名查询") @ApiOperation(value = "根据姓名查询")
@GetMapping("get/{name}") @GetMapping("get")
public Result<List<ServiceValuatorVO>> getDetails(@ApiParam(name = "name", value = "估价员姓名") @PathVariable @NotBlank String name) { public Result<List<ServiceValuatorVO>> getDetails(@ApiParam(name = "name", value = "估价员姓名") @RequestParam(required = false) String name) {
return success(serviceValuatorService.selectByName(name)); return success(serviceValuatorService.selectByName(name));
} }
......
...@@ -12,6 +12,7 @@ import com.onsiteservice.entity.user.User; ...@@ -12,6 +12,7 @@ import com.onsiteservice.entity.user.User;
import com.onsiteservice.miniapp.controller.worker.vo.ServiceValuatorVO; import com.onsiteservice.miniapp.controller.worker.vo.ServiceValuatorVO;
import com.onsiteservice.util.DateUtils; import com.onsiteservice.util.DateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -52,7 +53,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> { ...@@ -52,7 +53,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public List<ServiceValuatorVO> selectByName(String name) { public List<ServiceValuatorVO> selectByName(String name) {
log.info("valuator selectByName name: {}", name); log.info("valuator selectByName name: {}", name);
List<User> userList = userMapper.selectByNameLike(name); List<User> userList = userMapper.selectByNameLike(StringUtils.isBlank(name) ? null : name.trim());
return handle(userList); return handle(userList);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment