供应链增加人员配置、供应商人员
This commit is contained in:
		
							parent
							
								
									c58542bb16
								
							
						
					
					
						commit
						b754dcfed1
					
				| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
package com.bonus.canteen.core.ims.controller;
 | 
			
		||||
 | 
			
		||||
import com.bonus.canteen.core.ims.model.PersonSetting;
 | 
			
		||||
import com.bonus.canteen.core.ims.service.PersonSettingService;
 | 
			
		||||
import com.bonus.common.core.web.controller.BaseController;
 | 
			
		||||
import com.bonus.common.core.web.domain.AjaxResult;
 | 
			
		||||
import com.bonus.common.core.web.page.TableDataInfo;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import javax.validation.Valid;
 | 
			
		||||
 | 
			
		||||
@Api(tags = "供应链人员配置")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/person_setting")
 | 
			
		||||
public class PersonSettingController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PersonSettingService service;
 | 
			
		||||
    @ApiOperation("供应链人员配置-查询")
 | 
			
		||||
    @GetMapping("/getList")
 | 
			
		||||
    public TableDataInfo getList(PersonSetting dto) {
 | 
			
		||||
        startPage();
 | 
			
		||||
        return getDataTable(service.getList(dto));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "/add", produces = "application/json; charset=utf-8")
 | 
			
		||||
    @ApiOperation("供应链人员配置-新增")
 | 
			
		||||
    public AjaxResult add(@RequestBody PersonSetting dto) {
 | 
			
		||||
        return service.insert(dto);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "/delete", produces = "application/json; charset=utf-8")
 | 
			
		||||
    @ApiOperation("供应链人员配置-删除")
 | 
			
		||||
    public AjaxResult deleteById(@RequestBody PersonSetting dto) {
 | 
			
		||||
        return service.delete(dto);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @ApiOperation("供应链人员配置-修改")
 | 
			
		||||
    @PostMapping("/update")
 | 
			
		||||
    public AjaxResult update(@RequestBody @Valid PersonSetting dto) {
 | 
			
		||||
        return service.updateInfoById(dto);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
package com.bonus.canteen.core.ims.mapper;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
import com.bonus.canteen.core.ims.model.PersonSetting;
 | 
			
		||||
import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface PersonSettingMapper extends BaseMapper<PersonSetting> {
 | 
			
		||||
    List<PersonSetting> getList(PersonSetting dto);
 | 
			
		||||
 | 
			
		||||
    int delById(PersonSetting dto);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
package com.bonus.canteen.core.ims.model;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.IdType;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableField;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableId;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableName;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@TableName("ims_person_setting")
 | 
			
		||||
public class PersonSetting {
 | 
			
		||||
    @ApiModelProperty(value = "主键")
 | 
			
		||||
    @TableId(
 | 
			
		||||
            value = "id",
 | 
			
		||||
            type = IdType.AUTO
 | 
			
		||||
    )
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "姓名")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "手机号")
 | 
			
		||||
    private String phone;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "性别",notes = "1:男,2:女")
 | 
			
		||||
    private String sex;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "roleId",notes = "1:供应商,2:领料人,3:出库人,4:采购人")
 | 
			
		||||
    @TableField(value = "role_id")
 | 
			
		||||
    private String roleId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "角色名称")
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private String roleName;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "照片")
 | 
			
		||||
    private String photoUrl;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "是否删除",notes = "0:已删除,1:未删除")
 | 
			
		||||
    private Integer delFlag;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "创建时间")
 | 
			
		||||
    private String createTime;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "搜索关键词")
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private String searchValue;
 | 
			
		||||
    @ApiModelProperty(value = "类型")
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private String type;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
package com.bonus.canteen.core.ims.service;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
import com.bonus.canteen.core.ims.model.PersonSetting;
 | 
			
		||||
import com.bonus.common.core.web.domain.AjaxResult;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public interface PersonSettingService extends IService<PersonSetting> {
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取人员设置列表的泛型方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 人员设置数据传输对象,包含查询所需的各种参数
 | 
			
		||||
     * @return 返回一个不确定类型的列表,列表中的元素可以是任意类型
 | 
			
		||||
     */
 | 
			
		||||
    List<PersonSetting> getList(PersonSetting dto);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 插入人员设置信息的方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 包含人员设置信息的数据传输对象
 | 
			
		||||
     * @return AjaxResult 操作结果,通常包含操作状态和相关信息
 | 
			
		||||
     */
 | 
			
		||||
    AjaxResult insert(PersonSetting dto);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除人员设置的方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 包含要删除的人员设置信息的对象
 | 
			
		||||
     * @return AjaxResult 返回操作结果,包含操作状态和相关信息
 | 
			
		||||
     */
 | 
			
		||||
    AjaxResult delete(PersonSetting dto);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据ID更新个人信息设置
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 包含更新后个人信息设置的数据传输对象
 | 
			
		||||
     * @return AjaxResult 返回操作结果,包含操作是否成功及相关信息
 | 
			
		||||
     */
 | 
			
		||||
    AjaxResult updateInfoById(PersonSetting dto);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,76 @@
 | 
			
		|||
package com.bonus.canteen.core.ims.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
import com.bonus.canteen.core.ims.mapper.PersonSettingMapper;
 | 
			
		||||
import com.bonus.canteen.core.ims.model.PersonSetting;
 | 
			
		||||
import com.bonus.canteen.core.ims.service.PersonSettingService;
 | 
			
		||||
import com.bonus.common.core.exception.ServiceException;
 | 
			
		||||
import com.bonus.common.core.web.domain.AjaxResult;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class PersonSettingServiceImpl extends ServiceImpl<PersonSettingMapper, PersonSetting> implements PersonSettingService {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PersonSettingMapper mapper;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取人员设置列表的泛型方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 人员设置数据传输对象,包含查询所需的各种参数
 | 
			
		||||
     * @return 返回一个不确定类型的列表,列表中的元素可以是任意类型
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<PersonSetting> getList(PersonSetting dto) {
 | 
			
		||||
        return mapper.getList(dto);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 插入人员设置信息的方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 包含人员设置信息的数据传输对象
 | 
			
		||||
     * @return AjaxResult 操作结果,通常包含操作状态和相关信息
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public AjaxResult insert(PersonSetting dto) {
 | 
			
		||||
        //判断是否存在当前姓名
 | 
			
		||||
        PersonSetting personSetting = mapper.selectOne(new LambdaQueryWrapper<PersonSetting>().eq(PersonSetting::getPhone, dto.getPhone()));
 | 
			
		||||
        if (personSetting != null) {
 | 
			
		||||
          throw new ServiceException("手机号已存在");
 | 
			
		||||
        }
 | 
			
		||||
        return baseMapper.insert(dto) > 0 ? AjaxResult.success() : AjaxResult.error("插入失败");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除人员设置的方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 包含要删除的人员设置信息的对象
 | 
			
		||||
     * @return AjaxResult 返回操作结果,包含操作状态和相关信息
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public AjaxResult delete(PersonSetting dto) {
 | 
			
		||||
        return mapper.delById(dto) > 0 ? AjaxResult.success() : AjaxResult.error("删除失败");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据ID更新个人信息设置
 | 
			
		||||
     *
 | 
			
		||||
     * @param dto 包含更新后个人信息设置的数据传输对象
 | 
			
		||||
     * @return AjaxResult 返回操作结果,包含操作是否成功及相关信息
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public AjaxResult updateInfoById(PersonSetting dto) {
 | 
			
		||||
        //判断是否存在当前姓名 (排除自身)
 | 
			
		||||
        PersonSetting personSetting = mapper.selectOne(new LambdaQueryWrapper<PersonSetting>().eq(PersonSetting::getPhone, dto.getPhone()).ne(PersonSetting::getId, dto.getId()));
 | 
			
		||||
        if (personSetting != null) {
 | 
			
		||||
          throw new ServiceException("手机号已存在");
 | 
			
		||||
        }
 | 
			
		||||
        return baseMapper.updateById(dto) > 0 ? AjaxResult.success() : AjaxResult.error("更新失败");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -96,10 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="goodsType != null "> and cm.goods_type = #{goodsType}</if>
 | 
			
		||||
            <if test="barCode != null  and barCode != ''"> and cm.bar_code = #{barCode}</if>
 | 
			
		||||
            <if test="unitId != null "> and cm.unit_id = #{unitId}</if>
 | 
			
		||||
            <if test="unitName != null and unitName != '' and unitName == 'CRKYTJ' ">
 | 
			
		||||
                and (iu.unit_name = '斤' or iu.unit_name = '公斤')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="unitName != null and unitName != '' and unitName != 'CRKYTJ' ">
 | 
			
		||||
            <if test="unitName != null and unitName != ''">
 | 
			
		||||
                and iu.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="salePrice != null "> and cm.sale_price = #{salePrice}</if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,10 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="warehouseId != null "> and ii.warehouse_id = #{warehouseId}</if>
 | 
			
		||||
            <if test="materialId != null "> and ii.material_id = #{materialId}</if>
 | 
			
		||||
            <if test="unitId != null "> and ii.unit_id = #{unitId}</if>
 | 
			
		||||
            <if test="unitName != null and unitName != '' and unitName == 'CRKYTJ' ">
 | 
			
		||||
                and (iu.unit_name = '斤' or iu.unit_name = '公斤')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="unitName != null and unitName != '' and unitName != 'CRKYTJ' ">
 | 
			
		||||
            <if test="unitName != null and unitName != ''">
 | 
			
		||||
                and iu.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="minNum != null "> and ii.min_num = #{minNum}</if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
<?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">
 | 
			
		||||
<mapper namespace="com.bonus.canteen.core.ims.mapper.PersonSettingMapper">
 | 
			
		||||
 | 
			
		||||
    <select id="getList" resultType="com.bonus.canteen.core.ims.model.PersonSetting">
 | 
			
		||||
        SELECT id, name, phone, sex, role_id as roleId, photo_url as photoUrl,ips.create_time as createTime,
 | 
			
		||||
        if(role_id = 1,'供应商',sd.dict_label) as roleName
 | 
			
		||||
        FROM ims_person_setting ips
 | 
			
		||||
        left join sys_dict_data sd on ips.role_id = sd.dict_value and sd.dict_type = 'person_role'
 | 
			
		||||
        <where>
 | 
			
		||||
            and ips.del_flag = 1
 | 
			
		||||
            <if test="searchValue != null and searchValue != ''">
 | 
			
		||||
                and (
 | 
			
		||||
                    ips.name like concat('%', #{searchValue}, '%')
 | 
			
		||||
                    or ips.phone like concat('%', #{searchValue}, '%')
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="id != null">
 | 
			
		||||
                and ips.id = #{id}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="type != null and type != '' and type == 'supplier'">
 | 
			
		||||
                and ips.role_id = 1
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="type != null and type != '' and type != 'supplier'">
 | 
			
		||||
                and ips.role_id != 1
 | 
			
		||||
            </if>
 | 
			
		||||
        </where>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <delete id="delById">
 | 
			
		||||
        update ims_person_setting set del_flag = 0 where id = #{id}
 | 
			
		||||
    </delete>
 | 
			
		||||
</mapper>
 | 
			
		||||
		Loading…
	
		Reference in New Issue