Commit 24c71c79 by zhu.zewen

修复专账部门数据隔离

parent 373eac38
......@@ -9,6 +9,7 @@ import com.jmai.physic.vo.BillQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import javax.annotation.Nullable;
import java.util.List;
......@@ -19,7 +20,7 @@ public interface PhysicBillMapper extends BaseMapper<PhysicBill> {
Integer selectSumByName(@Param("name") String name,@Param("spec") String spec,@Param("factoryName") String factoryName,@Param("deptId")Long deptId);
List<BillInfoVO> selectByGroup(@Param("physicName") String physicName);
List<BillInfoVO> selectByGroup(@Param("physicName") String physicName, @Param("deptId") @Nullable Long deptId);
Page<BillQueryVO> selectBillPage(Page<BillQueryVO> page, @Param("req") PhysicBillQueryReq req);
}
......@@ -84,8 +84,8 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
@Override
public List<BillInfoVO> listBill(String physicName) {
List<BillInfoVO> billInfoVOS = physicBillMapper.selectByGroup(physicName);
Long deptId = SpringContextUtils.getDeptId();
List<BillInfoVO> billInfoVOS = physicBillMapper.selectByGroup(physicName, deptId);
return billInfoVOS;
}
......
......@@ -13,12 +13,23 @@
physic_name=#{name} and physic_spec=#{spec} and factory_name =#{factoryName} and dept_id =#{deptId}
</select>
<select id="selectByGroup" resultType="com.jmai.physic.vo.BillInfoVO">
select physic_name,physic_spec,factory_name from physic_bill
where physic_name LIKE CONCAT('%', #{physicName}, '%') group by physic_name,physic_spec,factory_name,dept_id
SELECT physic_name,physic_spec,factory_name
FROM physic_bill
WHERE del_flag = 0
AND physic_name LIKE CONCAT('%', #{physicName}, '%')
<if test="deptId != null">
AND dept_id = #{deptId}
</if>
GROUP BY physic_name,physic_spec,factory_name,dept_id
</select>
<select id="selectBillPage" resultType="com.jmai.physic.vo.BillQueryVO">
select *,b.dept_name from physic_bill a left join sys_dept b on a.dept_id =b.id where a.physic_name =#{req.physicName} and
a.physic_spec =#{req.physicSpec} and a.factory_name =#{req.factoryName} order by a.create_time desc
SELECT *, b.dept_name
FROM physic_bill a
LEFT JOIN sys_dept b ON a.dept_id =b.id
WHERE a.physic_name =#{req.physicName}
AND a.physic_spec =#{req.physicSpec}
AND a.factory_name =#{req.factoryName}
ORDER BY a.create_time DESC
</select>
......
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 sign in to comment