10/30 工位分格1.0
parent
b183c8c519
commit
1f92ad7a9a
@ -0,0 +1,85 @@
|
|||||||
|
package com.glxp.api.controller.auth;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.controller.BaseController;
|
||||||
|
import com.glxp.api.entity.basic.SysWorkplaceQueue;
|
||||||
|
import com.glxp.api.req.basic.SysWorkplaceQueueRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.service.basic.SysWorkplaceQueueService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhangsan
|
||||||
|
* @date : 2024/10/30 9:55
|
||||||
|
* @modyified By :
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class SysWorkplaceQueueController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
SysWorkplaceQueueService sysWorkplaceQueueService;
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/sysWorkplaceQueue/page")
|
||||||
|
public BaseResponse page(SysWorkplaceQueueRequest request) {
|
||||||
|
List<SysWorkplaceQueue> page = sysWorkplaceQueueService.filterList(request);
|
||||||
|
PageInfo<SysWorkplaceQueue> pageInfo = new PageInfo<>(page);
|
||||||
|
PageSimpleResponse<SysWorkplaceQueue> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(page);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/sysWorkplaceQueue/addQueue")
|
||||||
|
public BaseResponse addQueue(@RequestBody SysWorkplaceQueue sysWorkplaceQueue) {
|
||||||
|
// 创建时间 更新时间
|
||||||
|
sysWorkplaceQueue.setCreateTime(new Date());
|
||||||
|
sysWorkplaceQueue.setCreateUser(getUserId() + "");
|
||||||
|
sysWorkplaceQueue.setUpdateUser(getUserId() + "");
|
||||||
|
sysWorkplaceQueue.setUpdateTime(new Date());
|
||||||
|
boolean save = sysWorkplaceQueueService.saveQueue(sysWorkplaceQueue);
|
||||||
|
if (!save) {
|
||||||
|
return ResultVOUtils.error("新增错误");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success("新增成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/sysWorkplaceQueue/update")
|
||||||
|
public BaseResponse page(@RequestBody SysWorkplaceQueue sysWorkplaceQueue) {
|
||||||
|
sysWorkplaceQueue.setUpdateTime(new Date());
|
||||||
|
sysWorkplaceQueue.setUpdateUser(getUserId() + "");
|
||||||
|
boolean b = sysWorkplaceQueueService.updateById(sysWorkplaceQueue);
|
||||||
|
if (!b){
|
||||||
|
return ResultVOUtils.error(500,"更新失败");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success("更新成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/sysWorkplaceQueue/delete")
|
||||||
|
public BaseResponse deleteById(@RequestBody SysWorkplaceQueue sysWorkplaceQueue) {
|
||||||
|
//删除
|
||||||
|
sysWorkplaceQueueService.removeById(sysWorkplaceQueue);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/sysWorkplace/createQueueCode")
|
||||||
|
public BaseResponse createWorkplaceId() {
|
||||||
|
String code = sysWorkplaceQueueService.createQueueCode();
|
||||||
|
return ResultVOUtils.success(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhangsan
|
||||||
|
* @date : 2024/10/30 10:42
|
||||||
|
* @modyified By :
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysWorkplaceQueueRequest extends ListPageRequest {
|
||||||
|
private String key;
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private Long workPlaceIdFk;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,60 @@
|
|||||||
package com.glxp.api.service.basic;
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.exception.JsonException;
|
||||||
|
import com.glxp.api.req.basic.SysWorkplaceQueueRequest;
|
||||||
|
import com.glxp.api.res.basic.SysWorkplaceResponse;
|
||||||
|
import org.springframework.data.annotation.Reference;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.glxp.api.entity.basic.SysWorkplaceQueue;
|
import com.glxp.api.entity.basic.SysWorkplaceQueue;
|
||||||
import com.glxp.api.dao.basic.SysWorkplaceQueueMapper;
|
import com.glxp.api.dao.basic.SysWorkplaceQueueMapper;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SysWorkplaceQueueService extends ServiceImpl<SysWorkplaceQueueMapper, SysWorkplaceQueue> {
|
public class SysWorkplaceQueueService extends ServiceImpl<SysWorkplaceQueueMapper, SysWorkplaceQueue> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysWorkplaceQueueMapper sysWorkplaceQueueMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public List<SysWorkplaceQueue> filterList(SysWorkplaceQueueRequest request) {
|
||||||
|
if (null == request) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (null != request.getPage() && null != request.getLimit()) {
|
||||||
|
PageHelper.offsetPage((request.getPage() - 1) * request.getLimit(), request.getLimit());
|
||||||
|
}
|
||||||
|
return sysWorkplaceQueueMapper.filterList(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String createQueueCode() {
|
||||||
|
Long s = IdUtil.getSnowflakeNextId();
|
||||||
|
long eightDigitId = s % 100000000;
|
||||||
|
String code = "DM" + eightDigitId;
|
||||||
|
SysWorkplaceQueue sysWorkplaceQueue = sysWorkplaceQueueMapper.selectOne(new LambdaQueryWrapper<SysWorkplaceQueue>().eq(SysWorkplaceQueue::getCode, code));
|
||||||
|
if (sysWorkplaceQueue != null){
|
||||||
|
this.createQueueCode();
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean saveQueue(SysWorkplaceQueue sysWorkplaceQueue) {
|
||||||
|
SysWorkplaceQueue sysWorkplaceQueue1 = sysWorkplaceQueueMapper.selectOne(new LambdaQueryWrapper<SysWorkplaceQueue>().eq(SysWorkplaceQueue::getName, sysWorkplaceQueue.getName()));
|
||||||
|
if (sysWorkplaceQueue1 != null){
|
||||||
|
throw new JsonException(500,"当前分格已存在");
|
||||||
|
}
|
||||||
|
int insert = sysWorkplaceQueueMapper.insert(sysWorkplaceQueue);
|
||||||
|
if (insert == 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.glxp.api.dao.basic.SysWorkplaceQueueMapper">
|
<mapper namespace="com.glxp.api.dao.basic.SysWorkplaceQueueMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.SysWorkplaceQueue">
|
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.SysWorkplaceQueue">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
<!--@Table sys_workplace_queue-->
|
<!--@Table sys_workplace_queue-->
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||||
<result column="code" jdbcType="VARCHAR" property="code" />
|
<result column="code" jdbcType="VARCHAR" property="code"/>
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
<result column="workPlaceIdFk" jdbcType="BIGINT" property="workPlaceIdFk" />
|
<result column="workPlaceIdFk" jdbcType="BIGINT" property="workPlaceIdFk"/>
|
||||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
|
<result column="createUser" jdbcType="VARCHAR" property="createUser"/>
|
||||||
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
|
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, code, `name`, workPlaceIdFk, remark, createTime, updateTime, `createUser`, updateUser
|
id, code, `name`, workPlaceIdFk, remark, createTime, updateTime, `createUser`, updateUser
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
|
||||||
|
<select id="filterList" resultType="com.glxp.api.entity.basic.SysWorkplaceQueue">
|
||||||
|
select sys_workplace_queue.*
|
||||||
|
from sys_workplace_queue
|
||||||
|
<where>
|
||||||
|
<if test="key != null and key != ''">
|
||||||
|
AND (
|
||||||
|
code like concat('%', #{key}, '%')
|
||||||
|
or name like concat('%', #{key}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test=" workPlaceIdFk != null and workPlaceIdFk != ''">
|
||||||
|
AND workPlaceIdFk = #{workPlaceIdFk}
|
||||||
|
</if>
|
||||||
|
<!-- <if test=" code != null and code != ''">-->
|
||||||
|
<!-- AND code LIKE concat('%', #{code}, '%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test=" name != null and name != ''">-->
|
||||||
|
<!-- AND name LIKE concat('%', #{name}, '%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue