维护产品类型表 jsh_materialcategory

序列号表	jsh_serial_number
用户表	jsh_user
机构表	jsh_organization
机构用户关系表	jsh_orga_user_rel
对应的删除标记
This commit is contained in:
qiankunpingtai
2019-03-28 15:23:53 +08:00
parent e437abb0b0
commit 7dc1cdaafc
13 changed files with 102 additions and 48 deletions

View File

@@ -101,6 +101,9 @@ public class ExceptionConstants {
/**商品%s下序列号不充足请补充后重试*/
public static final int MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE = 10500002;
public static final String MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG = "商品:%s下序列号不充足请补充后重试";
/**删序列号信息失败*/
public static final int SERIAL_NUMBERE_DELETE_FAILED_CODE = 10500003;
public static final String SERIAL_NUMBERE_DELETE_FAILED_MSG = "删序列号信息失败";
/**
* 机构
* type = 110

View File

@@ -76,4 +76,5 @@ public class RoleController {
public List<Role> list(HttpServletRequest request) {
return roleService.getRole();
}
}

View File

@@ -5,14 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.serialNumber.SerialNumberService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -109,19 +107,26 @@ public class SerialNumberController {
return result;
}
/**
* create by: qiankunpingtai
* websitehttp://39.105.146.63/symphony/
* description:
* 逻辑删除序列号信息
* create time: 2019/3/27 17:43
* @Param: ids
* @return java.lang.Object
*/
@RequestMapping(value = "/serialNumber/batchDeleteSerialNumberByIds")
public Object batchDeleteSerialNumberByIds(@RequestParam("ids") String ids) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i= serialNumberService.batchDeleteSerialNumberByIds(ids);
if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_CODE,ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_CODE,
ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_MSG);
}
return result;
}
}

View File

@@ -60,4 +60,6 @@ public interface SerialNumberMapperEx {
* 批量添加序列号
* */
int batAddSerialNumber(@Param("list") List<SerialNumberEx> list);
int batchDeleteSerialNumberByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
}

View File

@@ -391,4 +391,23 @@ public class SerialNumberService {
}while(batAddTotal>0);
}
}
/**
* create by: qiankunpingtai
* websitehttp://39.105.146.63/symphony/
* description:
* 逻辑删除序列号信息
* create time: 2019/3/27 17:43
* @Param: ids
* @return
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSerialNumberByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return serialNumberMapperEx.batchDeleteSerialNumberByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}

View File

@@ -112,7 +112,7 @@ public class UserService {
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateUserByObj(User user) {
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
return userMapper.updateByPrimaryKeySelective(user);
@@ -128,7 +128,7 @@ public class UserService {
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int resetPwd(String md5Pwd, Long id) {
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User user = new User();
@@ -217,7 +217,7 @@ public class UserService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
@@ -274,7 +274,7 @@ public class UserService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateUserAndOrgUserRel(UserEx ue) throws Exception{
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
@@ -405,7 +405,7 @@ public class UserService {
* */
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void batDeleteUser(String ids) {
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
String idsArray[]=ids.split(",");

View File

@@ -41,7 +41,7 @@
<select id="getDepotList" parameterType="java.util.Map" resultMap="ResultMapEx">
select dep.*,usr.username as principalName
FROM jsh_depot dep
left join jsh_user usr on usr.id=dep.principal
left join jsh_user usr on usr.id=dep.principal and ifnull(usr.status,'0') not in('1','2')
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'" />

View File

@@ -7,8 +7,8 @@
<select id="selectByConditionLog" parameterType="com.jsh.erp.datasource.entities.LogExample" resultMap="ResultExMap">
select l.*,u.username userName
FROM jsh_log l left join jsh_user u
on l.userID = u.id
FROM jsh_log l
left join jsh_user u on l.userID = u.id and ifnull(u.status,'0') not in('1','2')
where 1=1
<if test="operation != null">
and l.operation like '%${operation}%'

View File

@@ -5,6 +5,7 @@
select *
FROM jsh_materialcategory
where 1=1
and ifnull(status,'0') !='2'
<if test="name != null">
and name like '%${name}%'
</if>
@@ -21,6 +22,7 @@
COUNT(id)
FROM jsh_materialcategory
WHERE 1=1
and ifnull(status,'0') !='2'
<if test="name != null">
and name like '%${name}%'
</if>
@@ -56,7 +58,7 @@
<if test="currentId != null">
and id !=#{currentId}
</if>
and status !='2'
and ifnull(status,'0') !='2'
order by sort asc
</select>
@@ -65,7 +67,7 @@
<include refid="Base_Column_List"/>,#{currentId} as currentId
FROM jsh_materialcategory
WHERE ParentId = -1
and status !='2'
and ifnull(status,'0') !='2'
<if test="currentId != null">
and id !=#{currentId}
</if>
@@ -103,7 +105,7 @@
FROM jsh_materialcategory
where 1=1
and serial_no=#{serialNo}
and status !='2'
and ifnull(status,'0') !='2'
</select>
</mapper>

View File

@@ -30,7 +30,7 @@
<if test="currentId != null">
and id !=#{currentId}
</if>
and org_stcd !='5'
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
@@ -42,7 +42,7 @@
<if test="currentId != null">
and id !=#{currentId}
</if>
and org_stcd !='5'
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
<insert id="addOrganization" parameterType="com.jsh.erp.datasource.entities.Organization"
@@ -85,7 +85,7 @@
select * from jsh_organization
where
1=1
and org_stcd!='5'
and ifnull(org_stcd,'0') !='5'
and org_parent_no='-1'
and org_abr='根机构'
and id in (

View File

@@ -26,6 +26,7 @@
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
and mat.name like #{materialName}
</if>
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -45,6 +46,7 @@
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
and mat.name like #{materialName}
</if>
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
</select>
<select id="findById" resultMap="SerialNumberExBaseResultMap">
@@ -54,10 +56,11 @@
ur.username as updaterName,ser.depothead_Id
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
left join jsh_user cr on ser.creator=cr.id
left join jsh_user ur on ser.updater=ur.id
left join jsh_user cr on ser.creator=cr.id and ifnull(cr.status,'0') not in('1','2')
left join jsh_user ur on ser.updater=ur.id and ifnull(ur.status,'0') not in('1','2')
where 1=1
and ser.id=#{id}
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
</select>
<select id="findBySerialNumber" resultMap="SerialNumberExBaseResultMap">
@@ -69,6 +72,7 @@
<if test="serialNumber != null">
and ser.serial_Number=#{serialNumber}
</if>
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
</select>
<insert id="addSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx"
@@ -120,7 +124,7 @@
<if test="materialId != null">
and ser.material_Id=#{materialId}
</if>
and ser.delete_Flag !='1'
and ifnull(ser.delete_Flag,'0') !='1'
and ser.is_Sell !='1'
</select>
<select id="countSerialNumberByMaterialIdAndDepotheadId" resultType="java.lang.Integer">
@@ -135,7 +139,7 @@
and ser.depothead_Id=#{depotheadId}
</if>
and ser.is_Sell =#{isSell,jdbcType=VARCHAR}
and ser.delete_Flag !='1'
and ifnull(ser.delete_Flag,'0') !='1'
</select>
<update id="sellSerialNumber">
update jsh_serial_number
@@ -156,6 +160,7 @@
and material_Id = #{materialId}
</if>
and is_Sell != '1'
and ifnull(delete_Flag,'0') !='1'
<if test="count != null">
and id in
( select batchSN.id from
@@ -165,6 +170,7 @@
and selFrom.material_Id = #{materialId}
</if>
and selFrom.is_Sell != '1'
and ifnull(selFrom.delete_Flag,'0') !='1'
limit 0,#{count}
) batchSN
)
@@ -190,6 +196,7 @@
and depothead_Id = #{depotheadId,jdbcType=BIGINT}
</if>
and is_Sell != '0'
and ifnull(delete_Flag,'0') !='1'
<if test="count != null">
and id in
( select batchSN.id from
@@ -202,6 +209,7 @@
and selFrom.depothead_Id = #{depotheadId,jdbcType=BIGINT}
</if>
and selFrom.is_Sell !='0'
and ifnull(selFrom.delete_Flag,'0') !='1'
limit 0,#{count}
) batchSN
)
@@ -219,6 +227,17 @@
)
</foreach>
</insert>
<update id="batchDeleteSerialNumberByIds">
update jsh_serial_number
set update_Time=#{updateTime},updater=#{updater},delete_Flag='1'
where 1=1
and ifnull(delete_Flag,'0') !='1'
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>

View File

@@ -11,7 +11,7 @@
select *
FROM jsh_user
where 1=1
and status not in('1','2')
and ifnull(status,'0') not in('1','2')
<if test="userName != null">
and username like '%${userName}%'
</if>
@@ -27,7 +27,7 @@
COUNT(id)
FROM jsh_user
WHERE 1=1
and status not in('1','2')
and ifnull(status,'0') not in('1','2')
<if test="userName != null">
and username like '%${userName}%'
</if>
@@ -40,10 +40,10 @@
user.description, user.remark,user.isystem,org.id as orgaId,org.org_abr,rel.user_blng_orga_dspl_seq,
rel.id as orgaUserRelId
FROM jsh_user user
left join jsh_orga_user_rel rel on user.id=rel.user_id and rel.delete_flag!='1'
left join jsh_organization org on rel.orga_id=org.id
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5'
where 1=1
and user.status not in('1','2')
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
<bind name="userName" value="'%' + _parameter.userName + '%'" />
and user.userName like #{userName}
@@ -114,7 +114,7 @@
user.description, user.remark,user.isystem
FROM jsh_user user
where 1=1
and user.status not in('1','2')
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
and user.userName = #{userName}
</if>
@@ -161,7 +161,7 @@
org.id, org.org_abr as text,org.org_no as orgNo,org.sort as sort,null as iconCls,'0' as type
FROM jsh_organization org
WHERE org.org_parent_no = #{orgNo}
and org.org_stcd !='5'
and ifnull(org.org_stcd,'0') !='5'
union all
select
user.id,user.username as text, null as orgNo,rel.user_blng_orga_dspl_seq as sort,'icon-user' as iconCls,'1' as type
@@ -170,8 +170,8 @@
1=1
and user.id=rel.user_id
and rel.orga_id=#{orgId}
and rel.delete_flag !='1'
and user.status not in ('1','2')
and ifnull(rel.delete_flag,'0') !='1'
and ifnull(user.status,'0') not in('1','2')
) node
order by sort asc
</select>
@@ -181,7 +181,7 @@
id, org_abr as text,org_no as orgNo,'0' as type
FROM jsh_organization
WHERE org_parent_no = -1
and org_stcd !='5'
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
</mapper>