Commit 523999a9 by 徐高华

模糊查询

parent cd4065f6
......@@ -28,6 +28,7 @@ public class HmQrcodeListQDTO extends BasePageInfo implements Serializable {
private String enterpriseId;
private String hmSelect;
private String hmSelectLike ;
private String storeSelect;
......@@ -52,6 +53,14 @@ public class HmQrcodeListQDTO extends BasePageInfo implements Serializable {
private List<String> storeId;
public String getHmSelectLike() {
return hmSelectLike;
}
public void setHmSelectLike(String hmSelectLike) {
this.hmSelectLike = hmSelectLike;
}
public Long getHmId() {
return hmId;
}
......
......@@ -26,14 +26,6 @@ public interface TabHaobanHmQrcodeMapper {
TabHaobanHmQrcode queryById(@Param("hmId") Long hmId);
/**
* 分页列表
*
* @param hmQrcodeListQDTO 查询条件
* @return 对象列表
*/
List<TabHaobanHmQrcode> queryListByPage(HmQrcodeListQDTO hmQrcodeListQDTO);
/**
* 新增数据
*
* @param tabHaobanHmQrcode 实例对象
......
......@@ -27,14 +27,6 @@ public interface HmQrcodeService {
HmQrcodeBO queryById(Long hmId);
/**
* 分页查询
*
* @param hmQrcodeListQDTO 筛选条件
* @return 查询结果
*/
Page<HmQrcodeBO> queryByPage(HmQrcodeListQDTO hmQrcodeListQDTO);
/**
* 新增数据
*
* @param hmQrcodeQDTO 实例对象
......
package com.gic.haoban.manage.service.service.hm.impl;
import com.gic.api.base.commons.Page;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
......@@ -17,15 +24,6 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeClerkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 活码(TabHaobanHmQrcode)表服务实现类
......@@ -44,9 +42,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
@Autowired
private TabHaobanHmClerkRelationMapper tabHaobanHmClerkRelationMapper;
@Autowired
private ClerkService clerkService ;
private ClerkService clerkService;
@Autowired
private StoreService storeService ;
private StoreService storeService;
@Override
public HmQrcodeBO queryById(Long hmId) {
......@@ -54,13 +52,6 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public Page<HmQrcodeBO> queryByPage(HmQrcodeListQDTO hmQrcodeListQDTO) {
PageHelper.startPage(hmQrcodeListQDTO.getPageNum(), hmQrcodeListQDTO.getPageSize());
List<TabHaobanHmQrcode> tabHaobanHmQrcodes = tabHaobanHmQrcodeMapper.queryListByPage(hmQrcodeListQDTO);
return PageUtil.changePageHelperToCurrentPage(new PageInfo<>(tabHaobanHmQrcodes), HmQrcodeBO.class);
}
@Override
public int insert(HmQrcodeQDTO hmQrcodeQDTO) {
hmQrcodeQDTO.setCreateTime(new Date());
hmQrcodeQDTO.setUpdateTime(new Date());
......@@ -121,9 +112,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer hmType) {
public HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer hmType) {
return EntityUtil.changeEntity(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, hmType));
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, hmType));
}
@Override
......@@ -138,7 +129,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String wxEnterpriseId, String enterpriseId, List<Long> groupIds, List<String> hmIds) {
public List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String wxEnterpriseId, String enterpriseId,
List<Long> groupIds, List<String> hmIds) {
return tabHaobanHmQrcodeMapper.getGroupIdNumByEnterpriseId(wxEnterpriseId, enterpriseId, groupIds, hmIds);
}
......@@ -192,6 +184,10 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
@Override
public List<String> listHmIdForIndex(HmQrcodeListQDTO qdto) {
if (StringUtils.isNotBlank(qdto.getHmSelect())) {
String params = qdto.getHmSelect();
qdto.setHmSelectLike("%" + params + "%");
}
return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto);
}
......@@ -201,34 +197,34 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public void updateClerkNameByClerkId(String enterpriseId,String clerkId, String clerkName, String clerkCode) {
tabHaobanHmQrcodeMapper.updateClerkNameByClerkId(enterpriseId,clerkId, clerkName, clerkCode);
tabHaobanHmClerkRelationMapper.updateClerkNameByClerkId(enterpriseId,clerkId, clerkName, clerkCode);
public void updateClerkNameByClerkId(String enterpriseId, String clerkId, String clerkName, String clerkCode) {
tabHaobanHmQrcodeMapper.updateClerkNameByClerkId(enterpriseId, clerkId, clerkName, clerkCode);
tabHaobanHmClerkRelationMapper.updateClerkNameByClerkId(enterpriseId, clerkId, clerkName, clerkCode);
}
@Override
public void updateStoreNameByStoreId(String enterpriseId,String storeId, String storeName, String storeCode) {
tabHaobanHmQrcodeMapper.updateStoreNameByStoreId(enterpriseId,storeId, storeName, storeCode);
tabHaobanHmClerkRelationMapper.updateStoreNameByStoreId(enterpriseId,storeId, storeName, storeCode);
public void updateStoreNameByStoreId(String enterpriseId, String storeId, String storeName, String storeCode) {
tabHaobanHmQrcodeMapper.updateStoreNameByStoreId(enterpriseId, storeId, storeName, storeCode);
tabHaobanHmClerkRelationMapper.updateStoreNameByStoreId(enterpriseId, storeId, storeName, storeCode);
}
@Override
public void updateClerkInfo(Long hmId, String newClerkId) {
TabHaobanHmQrcode entity = new TabHaobanHmQrcode() ;
TabHaobanHmQrcode entity = new TabHaobanHmQrcode();
entity.setHmId(hmId);
ClerkDTO newClerk = this.clerkService.getclerkById(newClerkId) ;
ClerkDTO newClerk = this.clerkService.getclerkById(newClerkId);
String clerkCode = newClerk.getClerkCode();
String clerkName = newClerk.getClerkName() ;
String clerkName = newClerk.getClerkName();
String storeId = newClerk.getStoreId();
StoreDTO newStore = this.storeService.getStore(storeId) ;
StoreDTO newStore = this.storeService.getStore(storeId);
String storeCode = newStore.getStoreCode();
String storeName = newStore.getStoreName() ;
String storeName = newStore.getStoreName();
entity.setClerkId(newClerkId);
entity.setClerkCode(clerkCode);
entity.setClerkName(clerkName);
entity.setStoreId(storeId);
entity.setStoreName(storeName);
entity.setStoreCode(storeCode);
this.tabHaobanHmQrcodeMapper.update(entity) ;
this.tabHaobanHmQrcodeMapper.update(entity);
}
}
......@@ -51,59 +51,6 @@
where hm_id = #{hmId}
</select>
<!--查询指定行数据-->
<select id="queryListByPage" resultMap="TabHaobanHmQrcodeMap">
select
<include refid="Base_Column_List"></include>
from tab_haoban_hm_qrcode
<where>
<if test="hmCode != null and hmCode != ''">
and hm_code = #{hmCode}
</if>
<if test="hmType != null">
and hm_type = #{hmType}
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
<if test="keyword != null and keyword != ''">
and ( name like CONCAT('%',#{keyword},'%') or hm_code like CONCAT('%',#{keyword},'%') or
creator_name like CONCAT('%',#{keyword},'%'))
</if>
<if test="createTimeStart != null">
and create_time <![CDATA[ >= ]]> #{createTime}
</if>
<if test="createTimeEnd != null">
and create_time <![CDATA[ >= ]]> #{createTimeEnd}
</if>
<if test="passFlag != null">
and pass_flag = #{passFlag}
</if>
<if test="statusFlag != null">
and status_flag = #{statusFlag}
</if>
<if test="storeSearch != null and storeSearch != ''">
and ( store_name like CONCAT('%',#{storeSearch},'%') or store_code like CONCAT('%',#{storeSearch},'%') )
</if>
<if test="hmGroupId != null">
and hm_group_id = #{hmGroupId}
</if>
<if test="null != storeIdList and storeIdList.size gt 0">
and store_id in
<foreach collection="storeIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="hmId" useGeneratedKeys="true">
......@@ -345,7 +292,7 @@
and a.wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="null != hmSelect and '' != hmSelect ">
and (a.hm_id=#{hmSelect} or a.hm_code=#{hmSelect} or a.name like '%${hmSelect}%' or a.creator_name like '%${hmSelect}%' )
and (a.hm_id=#{hmSelect} or a.hm_code=#{hmSelect} or a.name like #{hmSelectLike} or a.creator_name like #{hmSelectLike} )
</if>
<if test="null != clerkSelect and '' != clerkSelect">
and ( a.clerk_id = #{clerkSelect} or b.clerk_id = #{clerkSelect} )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment