kangwei: material_info 表添加:user_id 用户编号
正在显示
2 个修改的文件
包含
15 行增加
和
7 行删除
... | @@ -154,6 +154,8 @@ public class MaterialInfoController { | ... | @@ -154,6 +154,8 @@ public class MaterialInfoController { |
154 | Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize); | 154 | Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize); |
155 | QueryWrapper<MaterialInfo> queryWrapper = getMaterialInfoQueryWrapper(materialInfo); | 155 | QueryWrapper<MaterialInfo> queryWrapper = getMaterialInfoQueryWrapper(materialInfo); |
156 | //queryWrapper.in("status","'1','2'"); | 156 | //queryWrapper.in("status","'1','2'"); |
157 | queryWrapper.eq("user_id",BaseContextHandler.getUserId()); | ||
158 | |||
157 | IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper); | 159 | IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper); |
158 | result.setSuccess(true); | 160 | result.setSuccess(true); |
159 | result.setResult(pageList); | 161 | result.setResult(pageList); |
... | @@ -164,14 +166,16 @@ public class MaterialInfoController { | ... | @@ -164,14 +166,16 @@ public class MaterialInfoController { |
164 | private QueryWrapper<MaterialInfo> getMaterialInfoQueryWrapper(MaterialInfo materialInfo){ | 166 | private QueryWrapper<MaterialInfo> getMaterialInfoQueryWrapper(MaterialInfo materialInfo){ |
165 | QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper(); | 167 | QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper(); |
166 | String departIds = null; | 168 | String departIds = null; |
167 | if (StringUtils.isBlank(materialInfo.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { | 169 | if (StringUtils.isNotEmpty(materialInfo.getDepartId())) { |
168 | departIds = departService.getChildDepartId(BaseContextHandler.getDeparts()); | 170 | //departIds = departService.getChildDepartId(BaseContextHandler.getDeparts()); |
169 | }else{ | ||
170 | departIds = departService.getChildDepartId(materialInfo.getDepartId()); | 171 | departIds = departService.getChildDepartId(materialInfo.getDepartId()); |
172 | }else{ | ||
173 | departIds = BaseContextHandler.getDeparts(); | ||
171 | } | 174 | } |
172 | // Page<MaterialInfo> page = new Page<ErpSettlement>(pageNo, pageSize); | 175 | // Page<MaterialInfo> page = new Page<ErpSettlement>(pageNo, pageSize); |
173 | queryWrapper.eq("del_flag","0"); | 176 | queryWrapper.eq("del_flag","0"); |
174 | queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,",")); | 177 | // queryWrapper.eq("depart_id",materialInfo.getDepartId()); |
178 | //queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,",")); | ||
175 | if(StringUtils.isNotEmpty(materialInfo.getFacInformationtype())){ | 179 | if(StringUtils.isNotEmpty(materialInfo.getFacInformationtype())){ |
176 | queryWrapper.eq("fac_informationtype",materialInfo.getFacInformationtype()); | 180 | queryWrapper.eq("fac_informationtype",materialInfo.getFacInformationtype()); |
177 | } | 181 | } |
... | @@ -188,6 +192,7 @@ public class MaterialInfoController { | ... | @@ -188,6 +192,7 @@ public class MaterialInfoController { |
188 | if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){ | 192 | if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){ |
189 | queryWrapper.eq("standards_type",materialInfo.getStandardsType()); | 193 | queryWrapper.eq("standards_type",materialInfo.getStandardsType()); |
190 | } | 194 | } |
195 | queryWrapper.orderByDesc("create_time"); | ||
191 | return queryWrapper; | 196 | return queryWrapper; |
192 | } | 197 | } |
193 | 198 | ||
... | @@ -206,9 +211,10 @@ public class MaterialInfoController { | ... | @@ -206,9 +211,10 @@ public class MaterialInfoController { |
206 | Result<MaterialInfo> result = new Result<MaterialInfo>(); | 211 | Result<MaterialInfo> result = new Result<MaterialInfo>(); |
207 | try { | 212 | try { |
208 | if (StringUtils.isBlank(materialInfo.getDepartId())) { | 213 | if (StringUtils.isBlank(materialInfo.getDepartId())) { |
209 | String userCode = BaseContextHandler.getUserId(); | 214 | //String userCode = BaseContextHandler.getUserId(); |
210 | //根据用户id查询所属厂区 只要第一个 | 215 | //根据用户id查询所属厂区 只要第一个 |
211 | materialInfo.setDepartId(materialInfoService.queryFacByUserId(userCode)); | 216 | //materialInfo.setDepartId(materialInfoService.queryFacByUserId(userCode)); |
217 | materialInfo.setDepartId(BaseContextHandler.getRealDepartId()); | ||
212 | } | 218 | } |
213 | materialInfoService.save(materialInfo); | 219 | materialInfoService.save(materialInfo); |
214 | result.success("添加成功!"); | 220 | result.success("添加成功!"); | ... | ... |
... | @@ -41,6 +41,9 @@ public class MaterialInfo { | ... | @@ -41,6 +41,9 @@ public class MaterialInfo { |
41 | /**删除状态(0,正常,1已删除)*/ | 41 | /**删除状态(0,正常,1已删除)*/ |
42 | @ApiModelProperty(value = "删除状态(0,正常,1已删除)") | 42 | @ApiModelProperty(value = "删除状态(0,正常,1已删除)") |
43 | private String delFlag; | 43 | private String delFlag; |
44 | |||
45 | @ApiModelProperty(value = "用户编号") | ||
46 | private String userId; | ||
44 | /**创建人*/ | 47 | /**创建人*/ |
45 | @Excel(name = "创建人", width = 15,dictTable = "sys_user",dicCode = "username",dicText = "realname" ,orderNum = "6") | 48 | @Excel(name = "创建人", width = 15,dictTable = "sys_user",dicCode = "username",dicText = "realname" ,orderNum = "6") |
46 | @ApiModelProperty(value = "创建人" ) | 49 | @ApiModelProperty(value = "创建人" ) |
... | @@ -56,7 +59,6 @@ public class MaterialInfo { | ... | @@ -56,7 +59,6 @@ public class MaterialInfo { |
56 | @ApiModelProperty(value = "更新人") | 59 | @ApiModelProperty(value = "更新人") |
57 | private String updateBy; | 60 | private String updateBy; |
58 | /**更新时间*/ | 61 | /**更新时间*/ |
59 | |||
60 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | 62 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
61 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | 63 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
62 | @ApiModelProperty(value = "更新时间") | 64 | @ApiModelProperty(value = "更新时间") | ... | ... |
-
请 注册 或 登录 后发表评论