Explorar o código

选择开票单位(查询全部)

[user3] %!s(int64=4) %!d(string=hai) anos
pai
achega
f22edbf1f6

+ 4 - 0
src/main/java/com/jeeplus/modules/workclientinfo/dao/WorkClientInfoDao.java

@@ -30,6 +30,10 @@ public interface WorkClientInfoDao extends CrudDao<WorkClientInfo> {
     int countByUscCode(String uscCode);
     int queryCount(WorkClientInfo workClientInfo);
 
+    List<WorkClientInfo> findAll(WorkClientInfo workClientInfo);
+    int queryAllCount(WorkClientInfo workClientInfo);
+
+
 
     List<WorkClientInfo> findByName(WorkClientInfo workClientInfo);
 

+ 49 - 0
src/main/java/com/jeeplus/modules/workclientinfo/service/WorkClientInfoService.java

@@ -232,6 +232,55 @@ public class WorkClientInfoService extends CrudService<WorkClientInfoDao, WorkCl
         page.setList(list);
         return page;
     }
+    /**
+     * 获取开票单位
+     * @param page 分页对象
+     * @param workClientInfo
+     * @return
+     */
+    public Page<WorkClientInfo> findAllPage(Page<WorkClientInfo> page, WorkClientInfo workClientInfo) {
+        workClientInfo.setOfficeId(UserUtils.getSelectOffice().getId());
+//        workClientInfo.getSqlMap().put("dsf", dataScopeFilter(workClientInfo.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_CLIENT_INFO.getValue()));
+        long t1 = System.currentTimeMillis();
+        //根据项目类型获取对应的客户id个数
+        int count = workClientInfoDao.queryAllCount(workClientInfo);
+        page.setCount(count);
+        long t2 = System.currentTimeMillis();
+        logger.info("查询客户总数耗时:{}",t2-t1);
+        page.setCountFlag(false);
+        workClientInfo.setPage(page);
+        List<WorkClientInfo> list = workClientInfoDao.findAll(workClientInfo);
+        //根据客户id查询客户的相关客户类型
+        for (WorkClientInfo clientInfo: list) {
+            clientInfo.setJobTypeStr(workClientInfoDao.getJobTypeStr(clientInfo.getId()));
+        }
+        long t3 = System.currentTimeMillis();
+        logger.info("查询客户列表耗时:{}",t3-t2);
+        if(list!=null && list.size()>0){
+            for (int i = 0; i < list.size(); i++) {
+                WorkClientInfo entity = list.get(i);
+                List<WorkClientLinkman> linkmanList = findLinkmanList(entity);
+                entity.setWorkClientLinkmanList(linkmanList);
+                if(linkmanList!=null && linkmanList.size()>0){
+                    StringBuilder builder = new StringBuilder();
+                    for (int j = 0; j < linkmanList.size(); j++) {
+                        builder.append(linkmanList.get(j).getName());
+                        if(j<linkmanList.size()-1){
+                            builder.append(",");
+                        }
+                    }
+                    entity.setLinkManNames(builder.toString());
+                }
+                List<WorkClientBank> bankList = findBankList(entity);
+                entity.setWorkClientBankList(bankList);
+            }
+        }
+        long t4 = System.currentTimeMillis();
+        logger.info("查询客户详情耗时:{}",t4-t3);
+        logger.info("查询客户总耗时:{}",t4-t1);
+        page.setList(list);
+        return page;
+    }
 
 
 

+ 1 - 1
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java

@@ -703,7 +703,7 @@ public class WorkInvoiceController extends BaseController {
 	 */
 	@RequestMapping(value = "selectclient")
 	public String selectclient(WorkClientInfo client, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<WorkClientInfo> page = workClientInfoService.findPage(new Page<WorkClientInfo>(request, response), client);
+		Page<WorkClientInfo> page = workClientInfoService.findAllPage(new Page<WorkClientInfo>(request, response), client);
 		try {
 			fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
 			fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");

+ 143 - 0
src/main/resources/mappings/modules/workclientinfo/WorkClientInfoDao.xml

@@ -152,6 +152,149 @@
 		</choose>
 	</select>
 
+	<select id="findAll" resultType="WorkClientInfo" >
+		SELECT
+		<include refid="workClientInfoColumns"/>
+		,su.name as "userName"
+		FROM work_client_info a
+		<include refid="workClientInfoJoinsLink"/>
+		left join sys_user su on su.id = a.create_by
+		<if test="workClientLinkman != null and workClientLinkman.name !=null and workClientLinkman.name !=''">
+			LEFT JOIN work_client_linkman b ON a.id = b.client_id
+		</if>
+		left join work_client_job_type_info c on c.work_client_id=a.id
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<!--<if test="workClientLinkman != null and workClientLinkman.id != '' and workClientLinkman.id != null">-->
+			<!--LEFT JOIN work_client_linkman b ON a.id = b.client_id-->
+			<!--and b.id = #{workClientLinkman.id}-->
+			<!--</if>-->
+			<if test="name != null and name != ''">
+				AND a.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+			</if>
+			<if test="companyType != null and companyType != ''">
+				AND a.company_type = #{companyType}
+			</if>
+			<if test="companyIndustry != null and companyIndustry != ''">
+				AND a.company_industry = #{companyIndustry}
+			</if>
+			<if test="area != null and area.id != null and area.id != ''">
+				AND (a.area_id = #{area.id} OR find_in_set(#{area.id},a.area_parent_ids))
+			</if>
+			<if test="workClientLinkman != null and workClientLinkman.name != null and workClientLinkman.name !=''">
+				AND b.name LIKE concat('%',#{workClientLinkman.name},'%')
+			</if>
+			<if test="workClientLinkman != null and workClientLinkman.linkPhone != null and workClientLinkman.linkPhone !=''">
+				AND b.link_phone LIKE concat('%',#{workClientLinkman.linkPhone},'%')
+			</if>
+			<if test="address != null and address != ''">
+				AND a.address LIKE
+				<if test="dbName == 'oracle'">'%'||#{address}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{address}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{address},'%')</if>
+			</if>
+			<if test="clientType != null and clientType != ''">
+				AND a.client_type like concat('%',#{clientType},'%')
+			</if>
+			<if test="uscCode != null and uscCode != ''">
+				AND a.usc_code like concat('%',#{uscCode},'%')
+			</if>
+			<if test="beginDate !=null">
+				AND a.create_date >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.create_date &lt; #{endDate}
+			</if>
+			<if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
+				AND (a.create_by = #{createId} or su.name like concat('%',#{createNameStr},'%'))
+			</if>
+			AND a.company_id = #{currentUser.company.id}
+			<choose>
+				<when test="jobTypeShow !=null and jobTypeShow !=''">
+					AND c.job_type_id = #{jobTypeShow}
+				</when>
+				<otherwise>
+
+				</otherwise>
+			</choose>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	<select id="queryAllCount" resultType="int" >
+		SELECT
+		count(distinct a.id)
+		FROM work_client_info a
+		<if test="workClientLinkman != null and workClientLinkman.name !=null and workClientLinkman.name !=''">
+			LEFT JOIN work_client_linkman b ON a.id = b.client_id
+		</if>
+		left join work_client_job_type_info c on c.work_client_id=a.id
+		left join sys_user su on su.id = a.create_by
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="name != null and name != ''">
+				AND a.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+			</if>
+			<if test="companyType != null and companyType != ''">
+				AND a.company_type = #{companyType}
+			</if>
+			<if test="companyIndustry != null and companyIndustry != ''">
+				AND a.company_industry = #{companyIndustry}
+			</if>
+			<if test="area != null and area.id != null and area.id != ''">
+				AND (a.area_id = #{area.id} OR find_in_set(#{area.id},a.area_parent_ids))
+			</if>
+			<if test="workClientLinkman != null and workClientLinkman.name != null and workClientLinkman.name !=''">
+				AND b.name LIKE concat('%',#{workClientLinkman.name},'%')
+			</if>
+			<if test="workClientLinkman != null and workClientLinkman.linkPhone != null and workClientLinkman.linkPhone !=''">
+				AND b.link_phone LIKE concat('%',#{workClientLinkman.linkPhone},'%')
+			</if>
+			<if test="address != null and address != ''">
+				AND a.address LIKE
+				<if test="dbName == 'oracle'">'%'||#{address}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{address}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{address},'%')</if>
+			</if>
+			<if test="clientType != null and clientType != ''">
+				AND a.client_type like concat('%',#{clientType},'%')
+			</if>
+			<if test="uscCode != null and uscCode != ''">
+				AND a.usc_code like concat('%',#{uscCode},'%')
+			</if>
+			<if test="beginDate !=null">
+				AND a.create_date >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.create_date &lt; #{endDate}
+			</if>
+			<if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
+				AND (a.create_by = #{createId} or su.name = #{createNameStr})
+			</if>
+			AND a.company_id = #{currentUser.company.id}
+			<choose>
+				<when test="jobTypeShow !=null and jobTypeShow !=''">
+					AND c.job_type_id = #{jobTypeShow}
+				</when>
+				<otherwise>
+
+				</otherwise>
+			</choose>
+		</where>
+	</select>
+
     <select id="queryCount" resultType="int" >
         SELECT
         count(distinct a.id)