优化出入库单据和财务的资源权限的控制

This commit is contained in:
季圣华
2020-09-13 19:00:03 +08:00
parent 4fe0fc3970
commit 0f8e54d680
25 changed files with 415 additions and 296 deletions

View File

@@ -87,28 +87,6 @@ public class DepotHeadController {
return res;
}
/**
* 获取最大的id
* @param request
* @return
*/
@GetMapping(value = "/getMaxId")
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Long maxId = depotHeadService.getMaxId();
map.put("maxId", maxId);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 入库出库明细接口
* @param currentPage

View File

@@ -12,6 +12,8 @@ public class AccountHead {
private Long handsPersonId;
private Long creator;
private BigDecimal changeAmount;
private BigDecimal totalPrice;
@@ -60,6 +62,14 @@ public class AccountHead {
this.handsPersonId = handsPersonId;
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public BigDecimal getChangeAmount() {
return changeAmount;
}

View File

@@ -356,6 +356,66 @@ public class AccountHeadExample {
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(Long value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(Long value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(Long value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(Long value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(Long value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(Long value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<Long> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<Long> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(Long value1, Long value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(Long value1, Long value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andChangeAmountIsNull() {
addCriterion("change_amount is null");
return (Criteria) this;

View File

@@ -33,6 +33,10 @@ public class AccountHeadVo4ListEx {
private String handsPersonName;
private Long creator;
private String userName;
private String accountName;
private String billTimeStr;
@@ -149,6 +153,22 @@ public class AccountHeadVo4ListEx {
this.handsPersonName = handsPersonName;
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAccountName() {
return accountName;
}

View File

@@ -14,8 +14,6 @@ public class DepotHead {
private String number;
private String operPersonName;
private Date createTime;
private Date operTime;
@@ -24,6 +22,8 @@ public class DepotHead {
private Long handsPersonId;
private Long creator;
private Long accountId;
private BigDecimal changeAmount;
@@ -102,14 +102,6 @@ public class DepotHead {
this.number = number == null ? null : number.trim();
}
public String getOperPersonName() {
return operPersonName;
}
public void setOperPersonName(String operPersonName) {
this.operPersonName = operPersonName == null ? null : operPersonName.trim();
}
public Date getCreateTime() {
return createTime;
}
@@ -142,6 +134,14 @@ public class DepotHead {
this.handsPersonId = handsPersonId;
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public Long getAccountId() {
return accountId;
}

View File

@@ -446,76 +446,6 @@ public class DepotHeadExample {
return (Criteria) this;
}
public Criteria andOperPersonNameIsNull() {
addCriterion("oper_person_name is null");
return (Criteria) this;
}
public Criteria andOperPersonNameIsNotNull() {
addCriterion("oper_person_name is not null");
return (Criteria) this;
}
public Criteria andOperPersonNameEqualTo(String value) {
addCriterion("oper_person_name =", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameNotEqualTo(String value) {
addCriterion("oper_person_name <>", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameGreaterThan(String value) {
addCriterion("oper_person_name >", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameGreaterThanOrEqualTo(String value) {
addCriterion("oper_person_name >=", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameLessThan(String value) {
addCriterion("oper_person_name <", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameLessThanOrEqualTo(String value) {
addCriterion("oper_person_name <=", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameLike(String value) {
addCriterion("oper_person_name like", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameNotLike(String value) {
addCriterion("oper_person_name not like", value, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameIn(List<String> values) {
addCriterion("oper_person_name in", values, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameNotIn(List<String> values) {
addCriterion("oper_person_name not in", values, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameBetween(String value1, String value2) {
addCriterion("oper_person_name between", value1, value2, "operPersonName");
return (Criteria) this;
}
public Criteria andOperPersonNameNotBetween(String value1, String value2) {
addCriterion("oper_person_name not between", value1, value2, "operPersonName");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
@@ -756,6 +686,66 @@ public class DepotHeadExample {
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(Long value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(Long value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(Long value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(Long value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(Long value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(Long value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<Long> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<Long> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(Long value1, Long value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(Long value1, Long value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andAccountIdIsNull() {
addCriterion("account_id is null");
return (Criteria) this;

View File

@@ -13,6 +13,7 @@ public interface AccountHeadMapperEx {
List<AccountHeadVo4ListEx> selectByConditionAccountHead(
@Param("type") String type,
@Param("creatorArray") String[] creatorArray,
@Param("billNo") String billNo,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@@ -21,6 +22,7 @@ public interface AccountHeadMapperEx {
Long countsByAccountHead(
@Param("type") String type,
@Param("creatorArray") String[] creatorArray,
@Param("billNo") String billNo,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);

View File

@@ -21,7 +21,7 @@ public interface DepotHeadMapperEx {
List<DepotHeadVo4List> selectByConditionDepotHead(
@Param("type") String type,
@Param("subType") String subType,
@Param("handsPersonIds") String[] handsPersonIds,
@Param("creatorArray") String[] creatorArray,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@@ -33,15 +33,13 @@ public interface DepotHeadMapperEx {
Long countsByDepotHead(
@Param("type") String type,
@Param("subType") String subType,
@Param("handsPersonIds") String[] handsPersonIds,
@Param("creatorArray") String[] creatorArray,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("materialParam") String materialParam,
@Param("depotIds") String depotIds);
Long getMaxId();
String findMaterialsListByHeaderId(
@Param("id") Long id);
@@ -123,7 +121,7 @@ public interface DepotHeadMapperEx {
List<DepotHead> getDepotHeadListByOrganIds(@Param("organIds") String[] organIds);
List<DepotHead> getDepotHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
List<DepotHead> getDepotHeadListByCreator(@Param("creatorArray") String[] creatorArray);
BigDecimal getBuyAndSaleStatistics(
@Param("type") String type,

View File

@@ -11,7 +11,7 @@ public class DepotHeadVo4List extends DepotHead{
private String organName;
private String handsPersonName;
private String userName;
private String accountName;
@@ -37,12 +37,12 @@ public class DepotHeadVo4List extends DepotHead{
this.organName = organName;
}
public String getHandsPersonName() {
return handsPersonName;
public String getUserName() {
return userName;
}
public void setHandsPersonName(String handsPersonName) {
this.handsPersonName = handsPersonName;
public void setUserName(String userName) {
this.userName = userName;
}
public String getAccountName() {

View File

@@ -31,21 +31,23 @@ public class AccountHeadComponent implements ICommonQuery {
private List<?> getAccountHeadList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String type = StringUtil.getInfo(search, "type");
String roleType = StringUtil.getInfo(search, "roleType");
String billNo = StringUtil.getInfo(search, "billNo");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String order = QueryUtils.order(map);
return accountHeadService.select(type, billNo, beginTime, endTime, QueryUtils.offset(map), QueryUtils.rows(map));
return accountHeadService.select(type, roleType, billNo, beginTime, endTime, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String type = StringUtil.getInfo(search, "type");
String roleType = StringUtil.getInfo(search, "roleType");
String billNo = StringUtil.getInfo(search, "billNo");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
return accountHeadService.countAccountHead(type, billNo, beginTime, endTime);
return accountHeadService.countAccountHead(type, roleType, billNo, beginTime, endTime);
}
@Override

View File

@@ -11,6 +11,7 @@ import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
@@ -32,13 +33,13 @@ import static com.jsh.erp.utils.Tools.getCenternTime;
@Service
public class AccountHeadService {
private Logger logger = LoggerFactory.getLogger(AccountHeadService.class);
@Resource
private AccountHeadMapper accountHeadMapper;
@Resource
private AccountHeadMapperEx accountHeadMapperEx;
@Resource
private OrgaUserRelService orgaUserRelService;
@Resource
private UserService userService;
@Resource
private LogService logService;
@@ -79,11 +80,12 @@ public class AccountHeadService {
return list;
}
public List<AccountHeadVo4ListEx> select(String type, String billNo, String beginTime, String endTime, int offset, int rows) throws Exception{
public List<AccountHeadVo4ListEx> select(String type, String roleType, String billNo, String beginTime, String endTime, int offset, int rows) throws Exception{
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
List<AccountHeadVo4ListEx> list=null;
try{
list = accountHeadMapperEx.selectByConditionAccountHead(type, billNo, beginTime, endTime, offset, rows);
String [] creatorArray = getCreatorArray(roleType);
list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo, beginTime, endTime, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -102,21 +104,45 @@ public class AccountHeadService {
return resList;
}
public Long countAccountHead(String type, String billNo, String beginTime, String endTime) throws Exception{
public Long countAccountHead(String type, String roleType, String billNo, String beginTime, String endTime) throws Exception{
Long result=null;
try{
result = accountHeadMapperEx.countsByAccountHead(type, billNo, beginTime, endTime);
String [] creatorArray = getCreatorArray(roleType);
result = accountHeadMapperEx.countsByAccountHead(type, creatorArray, billNo, beginTime, endTime);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
/**
* 根据角色类型获取操作员数组
* @param roleType
* @return
* @throws Exception
*/
private String[] getCreatorArray(String roleType) throws Exception {
String creator = "";
User user = userService.getCurrentUser();
if(BusinessConstants.ROLE_TYPE_PRIVATE.equals(roleType)) {
creator = user.getId().toString();
} else if(BusinessConstants.ROLE_TYPE_THIS_ORG.equals(roleType)) {
creator = orgaUserRelService.getUserIdListByUserId(user.getId());
}
String [] creatorArray=null;
if(StringUtil.isNotEmpty(creator)){
creatorArray = creator.split(",");
}
return creatorArray;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertAccountHead(String beanJson, HttpServletRequest request) throws Exception{
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
int result=0;
try{
User userInfo=userService.getCurrentUser();
accountHead.setCreator(userInfo==null?null:userInfo.getId());
result = accountHeadMapper.insertSelective(accountHead);
logService.insertLog("财务",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillNo()).toString(), request);
@@ -274,6 +300,7 @@ public class AccountHeadService {
if(ah.getTotalPrice() != null) {
ah.setTotalPrice(ah.getTotalPrice().abs());
}
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
resList.add(ah);
}
}

View File

@@ -84,11 +84,11 @@ public class DepotHeadService {
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String number, String beginTime, String endTime,
String materialParam, String depotIds, int offset, int rows)throws Exception {
String [] handsPersonIdArray = getHandsPersonIdArray(roleType);
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
List<DepotHeadVo4List> list=null;
try{
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, handsPersonIdArray, number, beginTime, endTime, materialParam, depotIds, offset, rows);
String [] creatorArray = getCreatorArray(roleType);
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, number, beginTime, endTime, materialParam, depotIds, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -124,10 +124,10 @@ public class DepotHeadService {
public Long countDepotHead(String type, String subType, String roleType,String number, String beginTime, String endTime,
String materialParam, String depotIds) throws Exception{
String [] handsPersonIdArray = getHandsPersonIdArray(roleType);
Long result=null;
try{
result=depotHeadMapperEx.countsByDepotHead(type, subType, handsPersonIdArray, number, beginTime, endTime, materialParam, depotIds);
String [] creatorArray = getCreatorArray(roleType);
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, number, beginTime, endTime, materialParam, depotIds);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -135,36 +135,29 @@ public class DepotHeadService {
}
/**
* 根据角色类型获取经手人数组
* 根据角色类型获取操作员数组
* @param roleType
* @return
* @throws Exception
*/
private String[] getHandsPersonIdArray(String roleType) throws Exception {
String handsPersonIds = "";
private String[] getCreatorArray(String roleType) throws Exception {
String creator = "";
User user = userService.getCurrentUser();
if(BusinessConstants.ROLE_TYPE_PRIVATE.equals(roleType)) {
handsPersonIds = user.getId().toString();
creator = user.getId().toString();
} else if(BusinessConstants.ROLE_TYPE_THIS_ORG.equals(roleType)) {
handsPersonIds = orgaUserRelService.getUserIdListByUserId(user.getId());
creator = orgaUserRelService.getUserIdListByUserId(user.getId());
}
String [] handsPersonIdArray=null;
if(StringUtil.isNotEmpty(handsPersonIds)){
handsPersonIdArray = handsPersonIds.split(",");
String [] creatorArray=null;
if(StringUtil.isNotEmpty(creator)){
creatorArray = creator.split(",");
}
return handsPersonIdArray;
return creatorArray;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertDepotHead(String beanJson, HttpServletRequest request)throws Exception {
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
//判断用户是否已经登录过,登录过不再处理
Object userInfo = request.getSession().getAttribute("user");
if (userInfo != null) {
User sessionUser = (User) userInfo;
String uName = sessionUser.getUsername();
depotHead.setOperPersonName(uName);
}
depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
int result=0;
@@ -189,7 +182,6 @@ public class DepotHeadService {
depotHead.setId(id);
depotHead.setStatus(dh.getStatus());
depotHead.setCreateTime(dh.getCreateTime());
depotHead.setOperPersonName(dh.getOperPersonName());
int result=0;
try{
result = depotHeadMapper.updateByPrimaryKey(depotHead);
@@ -282,16 +274,6 @@ public class DepotHeadService {
}
}
public Long getMaxId()throws Exception {
Long result = null;
try{
result = depotHeadMapperEx.getMaxId();
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public String findMaterialsListByHeaderId(Long id)throws Exception {
String result = null;
try{
@@ -490,8 +472,7 @@ public class DepotHeadService {
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
//判断用户是否已经登录过,登录过不再处理
User userInfo=userService.getCurrentUser();
depotHead.setHandsPersonId(userInfo==null?null:userInfo.getId());
depotHead.setOperPersonName(userInfo==null?null:userInfo.getUsername());
depotHead.setCreator(userInfo==null?null:userInfo.getId());
depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
try{
@@ -550,8 +531,6 @@ public class DepotHeadService {
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
//判断用户是否已经登录过,登录过不再处理
depotHead.setId(id);
User userInfo=userService.getCurrentUser();
depotHead.setOperPersonName(userInfo==null?null:userInfo.getUsername());
try{
depotHeadMapper.updateByPrimaryKeySelective(depotHead);
}catch(Exception e){

View File

@@ -264,7 +264,7 @@ public class PersonService {
* */
List<DepotHead> depotHeadList =null;
try{
depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray);
depotHeadList=depotHeadMapperEx.getDepotHeadListByCreator(idArray);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@@ -6,6 +6,7 @@
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="organ_id" jdbcType="BIGINT" property="organId" />
<result column="hands_person_id" jdbcType="BIGINT" property="handsPersonId" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="change_amount" jdbcType="DECIMAL" property="changeAmount" />
<result column="total_price" jdbcType="DECIMAL" property="totalPrice" />
<result column="account_id" jdbcType="BIGINT" property="accountId" />
@@ -74,8 +75,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, type, organ_id, hands_person_id, change_amount, total_price, account_id, bill_no,
bill_time, remark, tenant_id, delete_flag
id, type, organ_id, hands_person_id, creator, change_amount, total_price, account_id,
bill_no, bill_time, remark, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="BaseResultMap">
select
@@ -109,15 +110,15 @@
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.AccountHead">
insert into jsh_account_head (id, type, organ_id,
hands_person_id, change_amount, total_price,
account_id, bill_no, bill_time,
remark, tenant_id, delete_flag
)
hands_person_id, creator, change_amount,
total_price, account_id, bill_no,
bill_time, remark, tenant_id,
delete_flag)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{organId,jdbcType=BIGINT},
#{handsPersonId,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL}, #{totalPrice,jdbcType=DECIMAL},
#{accountId,jdbcType=BIGINT}, #{billNo,jdbcType=VARCHAR}, #{billTime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
#{handsPersonId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL},
#{totalPrice,jdbcType=DECIMAL}, #{accountId,jdbcType=BIGINT}, #{billNo,jdbcType=VARCHAR},
#{billTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.AccountHead">
insert into jsh_account_head
@@ -134,6 +135,9 @@
<if test="handsPersonId != null">
hands_person_id,
</if>
<if test="creator != null">
creator,
</if>
<if test="changeAmount != null">
change_amount,
</if>
@@ -172,6 +176,9 @@
<if test="handsPersonId != null">
#{handsPersonId,jdbcType=BIGINT},
</if>
<if test="creator != null">
#{creator,jdbcType=BIGINT},
</if>
<if test="changeAmount != null">
#{changeAmount,jdbcType=DECIMAL},
</if>
@@ -219,6 +226,9 @@
<if test="record.handsPersonId != null">
hands_person_id = #{record.handsPersonId,jdbcType=BIGINT},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if test="record.changeAmount != null">
change_amount = #{record.changeAmount,jdbcType=DECIMAL},
</if>
@@ -254,6 +264,7 @@
type = #{record.type,jdbcType=VARCHAR},
organ_id = #{record.organId,jdbcType=BIGINT},
hands_person_id = #{record.handsPersonId,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=BIGINT},
change_amount = #{record.changeAmount,jdbcType=DECIMAL},
total_price = #{record.totalPrice,jdbcType=DECIMAL},
account_id = #{record.accountId,jdbcType=BIGINT},
@@ -278,6 +289,9 @@
<if test="handsPersonId != null">
hands_person_id = #{handsPersonId,jdbcType=BIGINT},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=BIGINT},
</if>
<if test="changeAmount != null">
change_amount = #{changeAmount,jdbcType=DECIMAL},
</if>
@@ -310,6 +324,7 @@
set type = #{type,jdbcType=VARCHAR},
organ_id = #{organId,jdbcType=BIGINT},
hands_person_id = #{handsPersonId,jdbcType=BIGINT},
creator = #{creator,jdbcType=BIGINT},
change_amount = #{changeAmount,jdbcType=DECIMAL},
total_price = #{totalPrice,jdbcType=DECIMAL},
account_id = #{accountId,jdbcType=BIGINT},

View File

@@ -5,13 +5,15 @@
<resultMap extends="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.entities.AccountHeadVo4ListEx">
<result column="OrganName" jdbcType="VARCHAR" property="organName" />
<result column="HandsPersonName" jdbcType="VARCHAR" property="handsPersonName" />
<result column="userName" jdbcType="VARCHAR" property="userName" />
<result column="AccountName" jdbcType="VARCHAR" property="accountName" />
</resultMap>
<select id="selectByConditionAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
select ah.*, s.supplier OrganName, p.Name HandsPersonName, a.Name AccountName
select ah.*, s.supplier OrganName, p.Name HandsPersonName, u.username userName, a.Name AccountName
from jsh_account_head ah
left join jsh_supplier s on ah.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
left join jsh_user u on ah.creator=u.id and ifnull(u.Status,'0') ='0'
left join jsh_person p on ah.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on ah.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
where 1=1
@@ -27,6 +29,13 @@
<if test="endTime != null">
and ah.bill_time &lt;= '${endTime}'
</if>
<if test="creatorArray != null">
and ah.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
and ifnull(ah.delete_flag,'0') !='1'
order by ah.id desc
<if test="offset != null and rows != null">
@@ -52,6 +61,13 @@
<if test="endTime != null">
and bill_time &lt;= '${endTime}'
</if>
<if test="creatorArray != null">
and creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
and ifnull(delete_flag,'0') !='1'
</select>

View File

@@ -7,11 +7,11 @@
<result column="sub_type" jdbcType="VARCHAR" property="subType" />
<result column="default_number" jdbcType="VARCHAR" property="defaultNumber" />
<result column="number" jdbcType="VARCHAR" property="number" />
<result column="oper_person_name" jdbcType="VARCHAR" property="operPersonName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="oper_time" jdbcType="TIMESTAMP" property="operTime" />
<result column="organ_id" jdbcType="BIGINT" property="organId" />
<result column="hands_person_id" jdbcType="BIGINT" property="handsPersonId" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="account_id" jdbcType="BIGINT" property="accountId" />
<result column="change_amount" jdbcType="DECIMAL" property="changeAmount" />
<result column="total_price" jdbcType="DECIMAL" property="totalPrice" />
@@ -91,11 +91,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, type, sub_type, default_number, number, oper_person_name, create_time, oper_time,
organ_id, hands_person_id, account_id, change_amount, total_price, pay_type, remark,
sales_man, account_id_list, account_money_list, discount, discount_money, discount_last_money,
other_money, other_money_list, other_money_item, account_day, status, link_number,
tenant_id, delete_flag
id, type, sub_type, default_number, number, create_time, oper_time, organ_id, hands_person_id,
creator, account_id, change_amount, total_price, pay_type, remark, sales_man, account_id_list,
account_money_list, discount, discount_money, discount_last_money, other_money, other_money_list,
other_money_item, account_day, status, link_number, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
select
@@ -129,9 +128,9 @@
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotHead">
insert into jsh_depot_head (id, type, sub_type,
default_number, number, oper_person_name,
create_time, oper_time, organ_id,
hands_person_id, account_id, change_amount,
default_number, number, create_time,
oper_time, organ_id, hands_person_id,
creator, account_id, change_amount,
total_price, pay_type, remark,
sales_man, account_id_list, account_money_list,
discount, discount_money, discount_last_money,
@@ -139,9 +138,9 @@
account_day, status, link_number,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{operPersonName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT},
#{handsPersonId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL},
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{handsPersonId,jdbcType=BIGINT},
#{creator,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL},
#{totalPrice,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{salesMan,jdbcType=VARCHAR}, #{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR},
#{discount,jdbcType=DECIMAL}, #{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL},
@@ -167,9 +166,6 @@
<if test="number != null">
number,
</if>
<if test="operPersonName != null">
oper_person_name,
</if>
<if test="createTime != null">
create_time,
</if>
@@ -182,6 +178,9 @@
<if test="handsPersonId != null">
hands_person_id,
</if>
<if test="creator != null">
creator,
</if>
<if test="accountId != null">
account_id,
</if>
@@ -256,9 +255,6 @@
<if test="number != null">
#{number,jdbcType=VARCHAR},
</if>
<if test="operPersonName != null">
#{operPersonName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
@@ -271,6 +267,9 @@
<if test="handsPersonId != null">
#{handsPersonId,jdbcType=BIGINT},
</if>
<if test="creator != null">
#{creator,jdbcType=BIGINT},
</if>
<if test="accountId != null">
#{accountId,jdbcType=BIGINT},
</if>
@@ -354,9 +353,6 @@
<if test="record.number != null">
number = #{record.number,jdbcType=VARCHAR},
</if>
<if test="record.operPersonName != null">
oper_person_name = #{record.operPersonName,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
@@ -369,6 +365,9 @@
<if test="record.handsPersonId != null">
hands_person_id = #{record.handsPersonId,jdbcType=BIGINT},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if test="record.accountId != null">
account_id = #{record.accountId,jdbcType=BIGINT},
</if>
@@ -438,11 +437,11 @@
sub_type = #{record.subType,jdbcType=VARCHAR},
default_number = #{record.defaultNumber,jdbcType=VARCHAR},
number = #{record.number,jdbcType=VARCHAR},
oper_person_name = #{record.operPersonName,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
oper_time = #{record.operTime,jdbcType=TIMESTAMP},
organ_id = #{record.organId,jdbcType=BIGINT},
hands_person_id = #{record.handsPersonId,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=BIGINT},
account_id = #{record.accountId,jdbcType=BIGINT},
change_amount = #{record.changeAmount,jdbcType=DECIMAL},
total_price = #{record.totalPrice,jdbcType=DECIMAL},
@@ -481,9 +480,6 @@
<if test="number != null">
number = #{number,jdbcType=VARCHAR},
</if>
<if test="operPersonName != null">
oper_person_name = #{operPersonName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
@@ -496,6 +492,9 @@
<if test="handsPersonId != null">
hands_person_id = #{handsPersonId,jdbcType=BIGINT},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=BIGINT},
</if>
<if test="accountId != null">
account_id = #{accountId,jdbcType=BIGINT},
</if>
@@ -562,11 +561,11 @@
sub_type = #{subType,jdbcType=VARCHAR},
default_number = #{defaultNumber,jdbcType=VARCHAR},
number = #{number,jdbcType=VARCHAR},
oper_person_name = #{operPersonName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
oper_time = #{operTime,jdbcType=TIMESTAMP},
organ_id = #{organId,jdbcType=BIGINT},
hands_person_id = #{handsPersonId,jdbcType=BIGINT},
creator = #{creator,jdbcType=BIGINT},
account_id = #{accountId,jdbcType=BIGINT},
change_amount = #{changeAmount,jdbcType=DECIMAL},
total_price = #{totalPrice,jdbcType=DECIMAL},

View File

@@ -4,7 +4,7 @@
<resultMap extends="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.vo.DepotHeadVo4List">
<result column="OrganName" jdbcType="VARCHAR" property="organName" />
<result column="HandsPersonName" jdbcType="VARCHAR" property="handsPersonName" />
<result column="userName" jdbcType="VARCHAR" property="userName" />
<result column="AccountName" jdbcType="VARCHAR" property="accountName" />
</resultMap>
@@ -41,10 +41,10 @@
</resultMap>
<select id="selectByConditionDepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select distinct dh.*, s.supplier OrganName, p.name HandsPersonName, a.name AccountName
select distinct dh.*, s.supplier OrganName, u.username userName, a.name AccountName
from jsh_depot_head dh
left join jsh_supplier s on dh.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
left join jsh_person p on dh.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_user u on dh.creator=u.id and ifnull(u.Status,'0') ='0'
left join jsh_account a on dh.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
@@ -70,10 +70,10 @@
<if test="depotIds != null">
and di.depot_id in (${depotIds})
</if>
<if test="handsPersonIds != null">
and dh.hands_person_id in (
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
#{handsPersonId}
<if test="creatorArray != null">
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
@@ -111,20 +111,16 @@
<if test="depotIds != null">
and di.depot_id in (${depotIds})
</if>
<if test="handsPersonIds != null">
and hands_person_id in (
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
#{handsPersonId}
<if test="creatorArray != null">
and creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
and ifnull(jsh_depot_head.delete_Flag,'0') !='1') tb
</select>
<select id="getMaxId" resultType="java.lang.Long">
select max(id) as id from jsh_depot_head
</select>
<select id="findMaterialsListByHeaderId" resultType="java.lang.String">
select group_concat(concat(jsh_material.`Name`,' ',jsh_material.Model)) as mName
from jsh_depot_item
@@ -327,10 +323,9 @@
</select>
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select dh.*, s.supplier OrganName, p.name HandsPersonName, a.name AccountName
select dh.*, s.supplier OrganName, a.name AccountName
from jsh_depot_head dh
left join jsh_supplier s on dh.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
left join jsh_person p on dh.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on dh.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
where 1=1
<if test="number != null">
@@ -381,14 +376,14 @@
)
and ifnull(delete_flag,'0') !='1'
</select>
<select id="getDepotHeadListByHandsPersonIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
<select id="getDepotHeadListByCreator" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
from jsh_depot_head
where 1=1
and hands_person_id in (
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
#{handsPersonId}
and creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
and ifnull(delete_flag,'0') !='1'